#ifndef __WIZ_SP_OCTREE_HPP__SHANHAOBO_19800429__
#define __WIZ_SP_OCTREE_HPP__SHANHAOBO_19800429__

#include "./WizSPOctreeNode.hpp"

namespace Wiz
{
    namespace Octree
    {
        template
        <
            class               DataT,
            class               TraceResultT,
            class               BoxT,
            class               WorldSizeT      = ::Wiz::Real::Type,
            ::Wiz::UInt::Type   IMaxWorldSize   = 512 * 1024,
            class               BaseT           = ::Wiz::Null::Type
        >
        struct Type :
            public ::Wiz::SP::Type
            <
                ::Wiz::Vector3::Type<WorldSizeT>,
                DataT, 
                BoxT,
                TraceResultT,
                WorldSizeT,
                IMaxWorldSize,
                ::Wiz::Octree::Node::Type
                <
                    ::Wiz::Vector3::Type<WorldSizeT>,
                    DataT,
                    WorldSizeT,
                    BaseT
                >
            >
        {
            //////////////////////////////////////////////////////////////////////////
            typedef WorldSizeT                                                      tWorldSize;

            typedef ::Wiz::Vector3::Type<tWorldSize>                                tLocation;

            typedef ::Wiz::Octree::Node::Type<DataT, tWorldSize, tWorldSize,BaseT>  tNode;

            typedef ::Wiz::SP::Type
            <
                ::Wiz::Vector3::Type<tWorldSize>,
                DataT,
                BoxT,
                TraceResultT,
                tWorldSize,
                IMaxWorldSize,
                tNode
            >                                                               tSuper;

            //////////////////////////////////////////////////////////////////////////
        public:
            Type() : tSuper()
            {
            }
            //////////////////////////////////////////////////////////////////////////
        public:
            virtual ::Wiz::Bool::Type LineTrace(
                tTraceResultArrayOut    OutTraceResult,
                tLocationIn             InStart,
                tLocationIn             InEnd,
                tTraceInfo&             InTraceInfo,
                tBoxIn                  InExtent
                )
            {
                return tSuper::LineTrace(OutTraceResult, InStart, InEnd, InTraceInfo, InExtent);
            }
        protected:
            virtual ::Wiz::Bool::Type LineTrace_NonExtent(
                tTraceResultArrayOut    OutTraceResult,
                tLocationIn             InStart,
                tLocationIn             InEnd,
                tTraceInfo&             InTraceInfo
                )
            {
                return OutTraceResult.Size() > 0;
            }

            virtual ::Wiz::Bool::Type LineTrace_Extent(
                tTraceResultArrayOut  OutTraceResult,
                tLocationIn         InStart,
                tLocationIn         InEnd,
                tTraceInfo&         InTraceInfo,
                tBoxIn              InExtent
                )
            {
                return OutTraceResult.Size() > 0;
            }

            //////////////////////////////////////////////////////////////////////////
        public:
            virtual ::Wiz::Bool::Type PointTrace(
                tTraceResultArrayOut    OutTraceResult,
                tLocationIn             InLocation,
                tBoxIn                  InExtent,
                tTraceInfo&             InTraceInfo
                )
            {
                return tSuper::PointTrace(OutTraceResult, InLocation, InTraceInfo, InExtent);
            }
        protected:
            virtual ::Wiz::Bool::Type PointTrace_NonExtent(
                tTraceResultArrayOut    OutTraceResult,
                tLocationIn             InLocation,
                tTraceInfo&             InTraceInfo
                )
            {
                return OutTraceResult.Size() > 0;
            }

            virtual ::Wiz::Bool::Type PointTrace_Extent(
                tTraceResultArrayOut    OutTraceResult,
                tLocationIn             InLocation,
                tTraceInfo&             InTraceInfo,
                tBoxIn                  InExtent
                )
            {
                return OutTraceResult.Size() > 0;
            }
            //////////////////////////////////////////////////////////////////////////
        }; /// struct Type
    } /// end of namespace Octree
} /// end of namespace Wiz

#endif /*__WIZ_SP_OCTREE_HPP__SHANHAOBO_19800429__*/
